﻿using ReflectionStudio.Core.Events;
using System;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using WPFExcelReport.Helpers;
namespace WPFExcelReport
{
    public partial class TEK05
    {
        public TEK05()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VEKPOS(); 
            this.DataContext = MV;
            InitializeComponent();
             if (!TBMain.Columns.Contains("PART"))
            {
                TBMain.Columns.Add("PART");
                TBMain.Columns.Add("PVAR");
                TBMain.Columns.Add("PFARBE");
            }
        }
        public override void LOADBYAUF()
        {
            TBMain.Clear();
            if (ORDERNUM.Length < 11)
                return;
            PM["ORDERNUM"] = ORDERNUM;
            PM["KRS"] = ORDERNUM.Substring(1, 2);
            PM["LFD"] = ORDERNUM.Substring(3, 6);
            PM["POS"] = ORDERNUM.Substring(9, 3);
            ((VEKPOS)MV).LOADBYEKP(PM);
            vwMaster.View.MoveCurrentToFirst();
            base.LOADBYAUF();
        }

        private void CloseEKPCommand(object sender, RoutedEventArgs e)
        {
            if (dwMaster == null)
                return;
            ((VEKPOS)MV).UpdateEKPOS(dwMaster, 13);
        }

    }
}
